"""
删
"""
heroes = ['死侍', '星爵', '蜘蛛侠', '金刚狼', '鹰眼', '夜魔侠', '杜姆博士', '绯红女巫']
# remove()
# Remove first occurrence of value.
# Raises ValueError if the value is not present.
heroes.remove('星爵')
print(heroes)
# ['钢铁侠', '蜘蛛侠', '金刚狼', '黑寡妇', '鹰眼', '夜魔侠', '杜姆博士', '绯红女巫']
# 如果存在多个匹配的元素 只会删除按下标顺序的第一个
# 不存在此元素将报错
# heroes.remove('绿巨人') ValueError: list.remove(x): x not in list
# print(heroes)

# pop()
# Remove and return item at index (default last).
# Raises IndexError if list is empty or index is out of range.
women_hero = heroes.pop(3)
print(women_hero)  # 黑寡妇
print(heroes)
# ['钢铁侠', '蜘蛛侠', '金刚狼', '鹰眼', '夜魔侠', '杜姆博士', '绯红女巫']

# clear()
# Remove all items from list.
# heroes.clear()
# print(heroes)  # []
